package com.zzstm.staservice.controller;


import com.zzstm.commonUtils.R;
import com.zzstm.staservice.client.UcenterClient;
import com.zzstm.staservice.service.StatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-11-21
 */
@RestController
@RequestMapping("/staservice/sta")
@CrossOrigin
public class StatisticsDailyController {

    @Autowired
    private StatisticsDailyService dailyService;

    //查询某天注册人数
    @PostMapping("/countRegister/{day}")
    public R countRegister(@PathVariable String day){
        dailyService.countRegister(day);
        return R.ok();
    }

    //图表显示，返回两部分数据，日期的json数组，数量的json数组
    @GetMapping("/showData/{type}/{begin}/{end}")
    public R showData(@PathVariable String type,@PathVariable String begin,@PathVariable String end){
        Map<String,Object> map = dailyService.showData(type,begin,end);
        return R.ok().data(map);
    }

}

